package com.fish.web.account;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.fish.account.po.Recharges;
import com.fish.common.constant.Constant;
import com.fish.common.constant.QueryPage;
import com.fish.common.web.BaseAction;
import com.fish.service.account.RechargesService;

public class RechargeAction extends BaseAction {
	private static final long serialVersionUID = -3694486694277924623L;
	private static final Log loger = LogFactory.getLog(RechargeAction.class);
	private RechargesService rechargesService;
	private Recharges recharges = new Recharges();
	private List<Recharges> rechargesList = new ArrayList<Recharges>();
	private QueryPage queryPage = new QueryPage();

	public String goToRecharge() {
		return SUCCESS;
	}
	public String rechargeAdd() {
		return SUCCESS;
	}

	public String goToAccountList() {
		if (recharges.getBeginTime() != null && !"".equals(recharges.getBeginTime()) && recharges.getEndTime() != null && !"".equals(recharges.getEndTime())) {
			
		}

		if(!getSessionUser().isAdmin()){
			recharges.setUserId(getSessionUser().getUserId());
		}
		
		Long count = rechargesService.queryRechargesCountByObject(recharges);
		if (count > 0) {
			queryPage = new QueryPage(count, Constant.DEFAULT_PAGE_SIZE, queryPage.getCurPage());
		}
		rechargesList = rechargesService.queryRechargesByObject(recharges, queryPage);
		loger.debug(rechargesList);
		return SUCCESS;
	}

	public Recharges getRecharges() {
		return recharges;
	}

	public void setRecharges(Recharges recharges) {
		this.recharges = recharges;
	}

	public QueryPage getQueryPage() {
		return queryPage;
	}

	public void setQueryPage(QueryPage queryPage) {
		this.queryPage = queryPage;
	}

	public List<Recharges> getRechargesList() {
		return rechargesList;
	}

	public void setRechargesService(RechargesService rechargesService) {
		this.rechargesService = rechargesService;
	}
	

}